<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org/">
<head th:replace="_fragment_front :: head(~{::title})">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>欢迎来到风铃的小站</title>
    <link rel="stylesheet" href="../static/css/me.css">
    <link rel="stylesheet" href="../static/lib/semantic/semantic.min.css">
</head>
<body class="body indexBody">

    <!--导航-->
    <nav id="nav" class="gird-header" style="display: none">
        <div class="ui container">
            <div class="ui inverted secondary stackable menu">
                <a th:href="@{/}"><h2 class="ui olive header item">风铃</h2></a>
                <a th:href="@{/}" class="active m-item item m-mobile-hide"><i class="home icon"></i>首页</a>
                <a th:href="@{/types}" class="m-item item m-mobile-hide"><i class="idea icon"></i>分类</a>
                <a th:href="@{/friends}" class="m-item item m-mobile-hide"><i class="pencil alternate icon"></i>友链</a>
                <a th:href="@{/resources}" class="m-item item m-mobile-hide"><i class="graduation cap icon"></i>资源库</a>
                <a th:href="@{/archives}" class="m-item item m-mobile-hide"><i class="clone icon"></i>归档</a>
                <div class="m-item item right m-mobile-hide">
                    <form th:action="@{/search}" name="search" target="_blank">
                        <div class="ui icon inverted transparent input m-margin-tb-tiny">
                            <input type="text" name="query" placeholder="Search....">
                            <i onclick="document.forms['search'].submit()" class="search link icon"></i>
                        </div>
                    </form>
                </div>

                <!--TODO 此处显示不太好，后续可以继续优化-->
                <img id="userAvatar" style="display: none" class="right item image m-login-avatar" alt="" th:src="@{/images/avatar.jpg}">
                <div id="userLog" style="margin-left: -18px !important; display: none" class="ui dropdown item">
                    <div id="userName" class="text">张三</div>
                    <i class="dropdown icon"></i>
                    <div class="menu">
                        <div class="item">
                            <i class="cog icon"></i>
                            <a class="m-black">个人设置</a>
                        </div>
                        <div class="item">
                            <i class="retweet icon"></i>
                            <a th:href="@{/login}" class="m-black">切换登录</a>
                        </div>
                        <div class="item">
                            <i class="sign-out icon"></i>
                            <a onclick="logout()" class="m-black">退出登录</a>
                        </div>
                    </div>
                </div>
                <a id="loginBtn" th:href="@{/login}" class="m-item right item m-mobile-hide"><i class="sign-in icon"></i>登录</a>
            </div>
        </div>
        <a href="#" class="ui menu toggle black icon button m-right-top m-mobile-show">
            <i class="sidebar icon"></i>
        </a>
    </nav>

    <!--顶部图片-->
    <div class="m-bg-class_outer m-index-top-image">
        <img th:src="@{/images/bg.jpg}" alt="" class="ui image m-bg m-top-image">
        <div class="m-bg-class_cover m-center">
            <div class="m-margin-top-maxx" align="center">
                <img th:src="@{/images/avatar.jpg}" alt="" class="ui circular image m-index-avatar">
            </div>
            <div class="m-font-size-title-mediul m-center" th:text="#{AdminName}"></div>
            <div class="m-center">
                <a href="#" class="ui wechat circular icon button"><i class="weixin icon"></i></a>
                <a href="#" class="ui QQ circular icon button"><i class="qq icon"></i></a>
                <a href="#" target="_blank" class="ui github circular icon button" data-content="点击跳转GitHub" data-position="bottom center"><i class="github icon"></i></a>
                <a href="#" class="ui email circular icon button" data-content="2540487435@qq.com" data-position="bottom center"><i class="envelope icon"></i></a>
            </div>

            <div class="ui wechat-qr flowing popup transition hidden">
                <img th:src="@{/images/wechat.png}" alt="" class="ui rounded image m-QR">
                <div class="m-center">微信</div>
            </div>
            <div class="ui qq-qr flowing popup transition hidden">
                <img th:src="@{/images/QQ.jpeg}" alt="" class="ui rounded image m-QR">
                <div class="m-center">QQ</div>
            </div>

            <div class="m-font-size-text m-center m-font-hua" th:text="#{index-sentence}"></div>
            <hr style="width: 35%; margin-left: 33%">

            <h5 class="m-font-size-text-init-title m-margin-top-large" th:text="#{verseOne}"></h5>
            <h5 class="m-font-size-text-init-title" th:text="#{verseTwo}"></h5>
            <h5 class="m-font-size-text-init-title" th:text="#{verseThree}"></h5>
            <h5 class="m-font-size-text-init-title" th:text="#{verseFour}"></h5>

            <div id="waypoint" class="ui m-margin-top-large m-center">
                <a th:href="@{/}" class="ui item circular icon button m-opacity-small m-item m-mobile-hide m-index-btn"><i class="home icon"></i>首页</a>
                <a th:href="@{/types}" class="ui item circular icon button m-opacity-small m-item m-mobile-hide m-index-btn"><i class="idea icon"></i>分类</a>
                <a th:href="@{/friends}" class="ui item circular icon button m-opacity-small m-item m-mobile-hide m-index-btn"><i class="pencil alternate icon"></i>友链</a>
                <a th:href="@{/resources}" class="ui item circular icon button m-opacity-small m-item m-mobile-hide m-index-btn"><i class="graduation cap icon"></i>资源库</a>
                <a th:href="@{/archives}" class="ui item circular icon button m-opacity-small m-item m-mobile-hide m-index-btn"><i class="clone icon"></i>归档</a>
            </div>
        </div>
    </div>

    <!--最新推荐-->
    <div class="ui m-padded-tb-large">
        <div class="ui m-container-small m-opacity">
            <div class="ui secondary segment m-center">
                <i class="bookmark icon"></i>最热推荐
            </div>
        </div>
        <div class="ui stackable grid m-container-mini m-opacity">
            <div class="four wide column m-margin-tb-tiny" th:each="hotBlog : ${hotBlogs}">
                <a th:href="@{/blog/{id}(id=${hotBlog.id})}" class="class_outer" target="_blank">
                    <img th:src="${hotBlog.cover}" alt="" class="ui rounded image m-hot-image">
                    <span class="class_cover" >
                        <h4 class="m-font-size-blog-text m-margin-tb-tiny" th:text="${hotBlog.title}">大圣，此去欲何?</h4>
                  </span>
                </a>
            </div>
        </div>
    </div>

    <!--中间内容-->
    <div class="animated fadeIn m-padded-tb">
        <div class="ui container">
            <div class="ui stackable grid">
                <!--博客内容-->
                <div class="ui vertical segment">
                    <div class="ui m-container-small m-opacity">
                        <div class="ui secondary segment m-center">
                            <i class="bookmark icon"></i>最新文章
                        </div>
                    </div>
                    <!--博文列表-->
                    <div class="ui padded segment m-padded-tb-large m-opacity" th:each="blog : ${blogs.getList()}">
                        <div class="ui large aligned mobile reversed stackable grid">
                            <div class="eleven wide column">
                                <h3 class="ui header"><a th:href="@{/blog/{id}(id=${blog.id})}" target="_blank" class="m-black m-title-font" th:text="${blog.title}">大圣，此去欲何</a></h3>
                                <p class="m-text" th:text="${blog.description}">戴上金箍，没法爱你；放下金箍，没法保护你。我知道上天不会给我第二次机会，曾经我们说好的永远，原来也仅仅只有，十二画，而已。“大圣，此去欲何?”“踏南天，碎凌霄。”“若一去不回……”“便一去不回” 其实很多时候，我们都是有机会的，最后真正放弃的，是我们自己。......</p>
                                <div class="ui grid">
                                    <div class="eleven wide column">
                                        <div class="ui mini horizontal link list">
                                            <div class="item">
                                                <img th:src="@{/images/avatar.jpg}" alt="" class="ui avatar image">
                                                <div class="content"><a th:href="@{/archives}" target="_blank" class="header" th:text="#{AdminName}">WindChime</a></div>
                                            </div>
                                            <div class="item">
                                                <i class="calendar icon m-icon"></i> <span class="m-icon-text" th:text="${#dates.format(blog.createTime, 'yyyy-MM-dd HH:mm:ss')}">2021-07-23</span>
                                            </div>
                                            <div class="item">
                                                <i class="eye icon m-icon"></i> <span class="m-icon-text" th:text="${blog.views}">1314</span>
                                            </div>
                                            <div class="item">
                                                <i class="comment outline icon m-icon"></i> <span class="m-icon-text" th:text="${blog.commentCount}">2021</span>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="right aligned five wide column">
                                        <a th:href="'/types?id=' + ${blog.typeId}" target="_blank" class="ui teal basic label m-padded-tiny m-text-thin" th:text="${blog.typeName}">好文</a>
                                    </div>
                                </div>
                            </div>
                            <div class="five wide column">
                                <a th:href="@{/blog/{id}(id=${blog.id})}" target="_blank">
                                    <img th:src="${blog.cover}" alt="" class="ui rounded image">
                                </a>
                            </div>
                        </div>
                    </div>
                </div>

                <!--分页-->
                <div class="ui bottom attached segment stackable grid m-opacity">
                    <div class="three wide column" align="center">
                        <a class="item" th:href="@{/(page=${blogs.hasPreviousPage} ? ${blogs.prePage} : 1)}" th:unless="${blogs.isFirstPage}">上一页</a>
                    </div>
                    <div class="ten wide column" align="center">
                        <p> <span th:text="${blogs.pageNum}"></span> / <span th:text="${blogs.pages}"></span> </p>
                    </div>
                    <div class="three wide column" align="center">
                        <a class="item" th:href="@{/(page=${blogs.hasNextPage} ? ${blogs.nextPage} : ${blogs.pages})}" th:unless="${blogs.isLastPage}">下一页</a>
                    </div>
                </div>

            </div>
        </div>
    </div>

    <!--置顶图标-->
    <div id="toolbar" class="m-padded-tb-large m-fixed m-right-bottom" style="display: none">
        <a href="#" class="ui teal icon button"><i class="chevron up icon"></i></a>
    </div>

    <br>
    <br>

    <!--底部栏-->
    <footer th:replace="_fragment_front :: footer" class="ui inverted vertical segment m-padded-tb-massive m-opacity">
        <!--容器-->
        <div class="ui center aligned container">
            <div class="ui inverted divided stackable grid">
                <div class="four wide column">
                    <div class="ui inverted m-text-thin m-text-spaced m-margin-top-max m-footer-title">联系我</div>
                    <div class="ui inverted link list">
                        <div class="m-text-thin">Email：2540487435@qq.com</div>
                        <div class="m-text-thin">QQ：2540487435</div>
                    </div>
                </div>

                <div class="four wide column" >
                    <div class="ui inverted link list">
                        <div class="item">
                            <!--微信二维码-->
                            <div class="ui inverted m-text-thin m-text-spaced m-footer-title">添加微信</div>
                            <img src="../static/images/wechat.png" class="ui m-margin-top rounded image m-QR" alt="">
                        </div>
                    </div>
                </div>

                <div class="four wide column">
                    <div class="ui inverted link list">
                        <div class="item">
                            <!--qq群二维码-->
                            <div class="ui inverted m-text-thin m-text-spaced m-footer-title">添加QQ</div>
                            <img src="../static/images/QQ.jpeg" class="ui m-margin-top rounded image m-QR" alt="">
                        </div>
                    </div>
                </div>
                <!--博客运行时间统计-->
                <div class="four wide column">
                    <div style="font-size: large;font-weight: bold" class="ui inverted m-text-thin m-text-spaced m-margin-top">博客总览</div>
                    <div id="blog-message">
                        <div class="ui inverted link list m-padded-tiny m-margin-top">
                            <div class="m-text-thin m-footer-position">
                                文章总数： <h4 class="ui orange header m-inline-block m-margin-top-null"> 1314 </h4> 篇
                            </div>
                            <div class="m-text-thin m-footer-position">
                                访问总数： <h4 class="ui orange header m-inline-block m-margin-top-null"> 1314 </h4> 次
                            </div>
                            <div class="m-text-thin m-footer-position">
                                评论总数： <h4 class="ui orange header m-inline-block m-margin-top-null"> 1314 </h4> 条
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="ui inverted section divider"></div>
            <div class="ui inverted m-text-thin m-text-spaced m-footer-time">此网站已运行：<span id="timer" class="item m-text-thin"></span></div>
        </div>
    </footer>

    <!--/*/<th:block th:replace="_fragment_front :: script">/*/-->
    <script src="../static/layuimini/lib/jquery-3.4.1/jquery-3.4.1.min.js"></script>
    <script src="../static/lib/semantic/semantic.min.js"></script>
    <script src="../static/lib/waypoints/jquery.waypoints.min.js"></script>
    <!--人物的看板娘-->
    <script src="https://eqcn.ajz.miesnfu.com/wp-content/plugins/wp-3d-pony/live2dw/lib/L2Dwidget.min.js"></script>

    <script>
        /*此处为网站的创建时间*/
        function setTime() {
            var create_time = Math.round(new Date(Date.UTC(2021, 6, 23, 0, 0, 0)).getTime() / 1000);
            var timestamp = Math.round((new Date().getTime() + 8 * 60 * 60 * 1000) / 1000);
            currentTime = secondToDate((timestamp - create_time));
            $('#timer').html(currentTime[0] + '年' + currentTime[1] + '天' + currentTime[2] + '时' + currentTime[3] + '分' + currentTime[4] + '秒')
        }
        setInterval(setTime, 1000)
        //计算时间
        function secondToDate(second) {
            if (!second) {
                return 0
            }
            var time = new Array(0, 0, 0, 0, 0)
            if (second >= 365 * 24 * 3600) {
                time[0] = parseInt(second / (365 * 24 * 3600))
                second %= 365 * 24 * 3600
            }
            if (second >= 24 * 3600) {
                time[1] = parseInt(second / (24 * 3600))
                second %= 24 * 3600
            }
            if (second >= 3600) {
                time[2] = parseInt(second / 3600)
                second %= 3600
            }
            if (second >= 60) {
                time[3] = parseInt(second / 60)
                second %= 60
            }
            if (second > 0) {
                time[4] = second
            }
            return time;
        }

        //看板娘初始化
        L2Dwidget.init({
            "model": {
                jsonPath: "https://unpkg.com/live2d-widget-model-miku@1.0.5/assets/miku.model.json",
                "scale": 1
            },
            "display": {
                "position": "left",
                "width": 120,
                "height": 170,
                "hOffset": 0,
                "vOffset": 0
            },
            "mobile": {
                "show": true,
                "scale": 0.5
            },
            "react": {
                "opacityDefault": 0.7,
                "opacityOnHover": 0.8
            },
        })

        //回到顶部按钮
        var waypoint = new Waypoint({
            element: $('#waypoint'),
            handler: function(direction) {
                if (direction == 'down') {
                    $('#toolbar').show(100)
                } else {
                    $('#toolbar').hide(500)
                }
            }
        })

        //手机汉堡菜单
        $('.menu.toggle').click(function () {
            $('.m-item').toggleClass('m-mobile-hide');
        })

    </script>
    <!--/*/</th:block>/*/-->

<!--雪花效果-->
<script src="http://www.lmlblog.com/winter/templets/xq/js/snowy.js"></script>
<script src="http://www.lmlblog.com/blog/12/js/Snow.js"></script>
<style type="text/css">
    .snow-container{position:fixed;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:100001;}
</style>
<div class="snow-container"></div>

    <script>
        // 显示微信
        $('.wechat').popup({
            popup : $('.wechat-qr'),
            position: 'bottom center'
        })

        // 显示QQ
        $('.QQ').popup({
            popup : $('.qq-qr'),
            position: 'bottom center'
        })

        // 显示邮箱
        $('.email').popup()

        // 显示github
        $('.github').popup()

        // 导航栏显示
        var waypoint = new Waypoint({
            element: document.getElementById('waypoint'),
            handler: function(direction) {
                if (direction == 'down') {
                    $('#nav').show(400);
                } else {
                    $('#nav').hide(400);
                }
            }
        })
    </script>

</body>
</html>
